﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.CopsBanditsUI.OfficerCellStates {
    import flash.events.*;
    import org.aswing.*;
    import Classes.*;
    import Modules.workers.*;
    import Display.CopsBanditsUI.*;
    import Display.aswingui.*;

    public class OnDutyOfficerState extends GenericOfficerState {

        public function OnDutyOfficerState(_arg1:CopData, _arg2:int, _arg3:OfficerCell){
            super(_arg1, _arg2, _arg3);
        }
        override protected function makeActionPanel():JPanel{
            var _local1:JPanel = ASwingHelper.makeFlowJPanel(FlowLayout.RIGHT);
            var _local2:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER, -5);
            var _local3:JPanel = ASwingHelper.makeFlowJPanel(FlowLayout.RIGHT);
            var _local4:JPanel = ASwingHelper.makeFlowJPanel(FlowLayout.RIGHT);
            var _local5:JLabel = ASwingHelper.makeLabel(ZLoc.t("Dialogs", "Cops_status_onduty"), EmbeddedArt.TITLE_FONT, 14, EmbeddedArt.blueTextColor);
            var _local6:JLabel = ASwingHelper.makeLabel(ZLoc.t("Dialogs", "Cops_hint_onduty"), EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 12, EmbeddedArt.blueTextColor);
            _local3.append(_local5);
            _local4.append(_local6);
            _local2.appendAll(_local3, _local4);
            _local1.append(_local2);
            return (_local1);
        }
        override protected function changeState():void{
            if (((m_nextActiveTimer) && (m_nextActiveTimer.hasEventListener(TimerEvent.TIMER)))){
                m_nextActiveTimer.stop();
                m_nextActiveTimer.removeEventListener(TimerEvent.TIMER, updateTimerString);
            };
            var _local1:CopsNBanditsWorkers = (Global.copsNBanditsWorkerManager.getWorkers("cops") as CopsNBanditsWorkers);
            var _local2:CopData = _local1.getCopData(m_pos);
            _local2.setTimestamp(Math.floor((GlobalEngine.getTimer() / 1000)));
            _local2.setState(CopData.STATE_SLEEPING);
            _local1.setCopData(_local2);
            this.rebuildEvent();
        }
        override protected function rebuildEvent():void{
            m_cell.forceRebuildCell(OfficerCell.STATE_SLEEPING, false, true);
        }

    }
}//package Display.CopsBanditsUI.OfficerCellStates 
